<?php
namespace App\Providers;

use App\Services\WebSocketService;
use Illuminate\Support\ServiceProvider;

class WebSocketServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton('websocket', function ($app) {
            return new WebSocketService();
        });
    }

    public function boot()
    {
        // 启动WebSocket服务
        if ($this->app->runningInConsole()) {
            $this->commands([
                \App\Console\Commands\StartWebSocketServer::class,
            ]);
        }
    }
}
